package com.ruoyi.fallbackFactory;

import com.ruoyi.domain.Community;
import com.ruoyi.domain.Building;
import com.ruoyi.domain.Task;
import com.ruoyi.feign.UserTaskFeignClient;
import com.ruoyi.domain.Resident;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;

/**
 * @author 小林同学
 * @version 1.0
 * @description: TODO
 * @date 2023/4/10 19:13
 */
public class UserFeignClientFallbackFactory implements FallbackFactory<UserTaskFeignClient> {
    @Override
    public UserTaskFeignClient create(Throwable cause) {
        cause.printStackTrace();
        return new UserTaskFeignClient() {
            @Override
            public Community communityGetInfo(Long id) {
                return new Community();
            }

            @Override
            public Building buildingGetInfo(Long id) {
                return new Building();
            }

            @Override
            public Resident residentGetInfo(Long id) {
                return new Resident();
            }

            @Override
            public List<Resident> residentByBuildingId(Task task) {
                return null;
            }
        };
    }
}
